import GenerateNewID.DataCell;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;

public class FileSame {
    public FileSame(String f1,String f2){

        String s1 =loadFile(f1).toString();
        String s2 =loadFile(f2).toString();
        for (int i = 0; i < s1.length(); i++) {
            if(s1.charAt(i)!=s2.charAt(i)){
                System.out.println(i);
                break;
            }

        }
        if(s1.equals(s2))
            System.out.println("答案一致");
        else
            System.out.println("答案不一致");
    }
    public StringBuilder loadFile(String readFile){
        StringBuilder  stringBuilder = new StringBuilder();
        BufferedReader reader = null;
        try {
            reader = new BufferedReader(new FileReader(readFile));
        } catch (FileNotFoundException exception) {
            System.err.println(readFile + " File Not Found");
        }
        String line = "";
        ArrayList<DataCell> ret = new ArrayList<>();
        try {
            while ((line = reader.readLine()) != null) {
                stringBuilder.append(line);
            }
        } catch (IOException exception) {
            System.err.println(exception.getMessage());
        }
        return stringBuilder;
    }
    public static void main(String[] args) {
        String f1 = "src/data/tmp.txt";
        String f2 ="src/data/3738/result.txt";

        boolean[] restore = new boolean[3];
        boolean[] a = new boolean[3];
        a[0] = true ; a[1] =true;
        System.arraycopy(restore,0,a,0,a.length);
       new FileSame(f1,f2);
    }
}
